import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SimulationVO, SimulationForm, SimulationQuery } from '@/api/bykt/simulation/types';

/**
 * 查询模拟卷列表
 * @param query
 * @returns {*}
 */

export const listSimulation = (query?: SimulationQuery): AxiosPromise<SimulationVO[]> => {
  return request({
    url: '/bykt/simulation/list',
    method: 'get',
    params: {...query}
  });
};

/**
 * 查询模拟卷详细
 * @param id
 */
export const getSimulation = (id: string | number): AxiosPromise<SimulationVO> => {
  return request({
    url: '/bykt/simulation/' + id,
    method: 'get'
  });
};

/**
 * 新增模拟卷
 * @param data
 */
export const addSimulation = (data: SimulationForm) => {
  return request({
    url: '/bykt/simulation',
    method: 'post',
    data: data
  });
};

/**
 * 修改模拟卷
 * @param data
 */
export const updateSimulation = (data: SimulationForm) => {
  return request({
    url: '/bykt/simulation',
    method: 'put',
    data: data
  });
};

/**
 * 删除模拟卷
 * @param id
 */
export const delSimulation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/bykt/simulation/' + id,
    method: 'delete'
  });
};
